package com.wg.controller;

import com.wg.R;
import com.wg.entity.Applys;
import com.wg.entity.dto.ApplyDto;
import com.wg.service.ApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/applys")
public class ApplyController {

    @Autowired
    ApplyService applyService;

    /**
     * web端的apply相关接口
     */

    @PostMapping
    public R addApply(@RequestBody @Validated ApplyDto apply) {
        return applyService.addApply(apply);
    }

    @PatchMapping
    public R updateApply(@RequestBody @Validated ApplyDto apply) {
        return applyService.updateApply(apply);
    }

    @GetMapping
    public R<List<Applys>> queryApply(@RequestParam(name = "wgId") Long wgId) {
        return applyService.queryApplyByWg(wgId);

    }


}
